package servlet;

import javabean.db_conn;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;

public class del_order extends HttpServlet {

	protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		req.setCharacterEncoding("utf-8");
		//HttpSession session = req.getSession();
		String p_name = req.getParameter("p_name");

		db_conn conn = new db_conn();
		String sql = "delete from t_order where p_name = '"+ p_name +"'and (useful=1 or useful=2)";
		Integer res = conn.executeInsert(sql);
		System.out.println(res);
		resp.sendRedirect("admin/order_list.jsp");


	}
	protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
		try {
			doPost(req,resp);
		} catch (ServletException e) {
			e.printStackTrace();
		}
	}
}